package processes;

import java.util.LinkedList;
import resources.Resource;

/**
 *
 * @author Ramunas
 */
public class ProcDescriptor {
    protected String name;  //isorinis vardas
    protected Cpu cpu; //procesoriaus busena
    protected String ram; //proceso operatyvioji atmintis
    protected LinkedList<Resource> resources; //turimu resursu sarasas
    protected LinkedList<Resource> createdResources; //sukurtu resursu sarasas
    protected String state; //proceso busena
    protected LinkedList<Integer> processes;  //sarasas i kuri itrauktas procesas
    protected Integer parent; //tevinio proceso vidinis vardas
    protected LinkedList<Integer> children; //proceso vaiku sarasas

    public ProcDescriptor(){
        resources = new LinkedList<Resource>();
        createdResources = new LinkedList<Resource>();
        processes = new LinkedList<Integer>();
        children = new LinkedList<Integer>();
    }
    
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the cpu
     */
    public Cpu getCpu() {
        return cpu;
    }

    /**
     * @param cpu the cpu to set
     */
    public void setCpu(Cpu cpu) {
        this.cpu = cpu;
    }

    /**
     * @return the ram
     */
    public String getRam() {
        return ram;
    }

    /**
     * @param ram the ram to set
     */
    public void setRam(String ram) {
        this.ram = ram;
    }

    /**
     * @return the resources
     */
    public LinkedList<Resource> getResources() {
        return resources;
    }

    /**
     * @param resources the resources to set
     */
    public void setResources(LinkedList<Resource> resources) {
        this.resources = resources;
    }

    /**
     * @return the createdResources
     */
    public LinkedList<Resource> getCreatedResources() {
        return createdResources;
    }

    public void setCreatedResources(LinkedList<Resource> createdResources) {
        this.createdResources = createdResources;
    }
    
    public boolean addCreatedResource(Resource resource) {
        return this.createdResources.add(resource);
    }
    
    public boolean removeCreatedResource(Resource resource){
        return this.createdResources.remove(resource);
    }

    /**
     * @return the state
     */
    public String getState() {
        return state;
    }

    /**
     * @param state the state to set
     */
    public void setState(String state) {
        this.state = state;
    }

    /**
     * @return the processes
     */
    public LinkedList<Integer> getProcesses() {
        return processes;
    }

    /**
     * @param processes the processes to set
     */
    public void setProcesses(LinkedList<Integer> processes) {
        this.processes = processes;
    }

    /**
     * @return the parent
     */
    public Integer getParent() {
        return parent;
    }

    /**
     * @param parent the parent to set
     */
    public void setParent(Integer parent) {
        this.parent = parent;
    }

    /**
     * @return the children
     */
    public LinkedList<Integer> getChildren() {
        return children;
    }

    /**
     * @param children the children to set
     */
    public void setChildren(LinkedList<Integer> children) {
        this.children = children;
    }
   
    public void addChildren(Integer child){
        this.children.add(child);
    }
    
    private class Cpu {
        private String sp;
        private String ip;
        private String ptr;
        private boolean mode;
        private int pi;
        private int si;
        private int ti;
        private String sf;
    }
    
}
